import socket
import threading
import time

user_id = input('用户ID:')
client = socket.socket(socket.AF_INET)
client.connect(('10.36.172.138', 7600))
# 用户身份验证？？？
msg = f'user_id={user_id}'
client.send(msg.encode('utf-8'))

class SubjectMessageThread(threading.Thread):
    def run(self) -> None:
        print('-开始订阅消息--')
        while True:
            msg = client.recv(8192)
            print('-接收到的消息--', msg)
try:
    s = SubjectMessageThread()
    s.start()
    s.join()
except Exception as e:
    print(e)

client.send(b'bye')
time.sleep(2)
print('--offline--')

